using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using SmartLink.Job.App_Start;
using Topshelf;
using Autofac;
using Quartz;

namespace SmartLink.Job
{
    class Program
    {
        static void Main(string[] args)
        {
            log4net.Config.XmlConfigurator.ConfigureAndWatch(new FileInfo(AppDomain.CurrentDomain.BaseDirectory + "log4net.config"));
            HostFactory.Run(x =>
            {
                x.UseLog4Net();
                var container = Bootstrapper.InitializeContainer();
                x.Service(() => new ServiceRunner(container.Resolve<IScheduler>()));
                x.RunAsLocalSystem();

                x.SetDescription("SmartLinkERP定时任务");
                x.SetDisplayName("SmartLink.Job");
                x.SetServiceName("SmartLink.Job");
                x.EnablePauseAndContinue();
            });
        }
    }
}
